package edu.yngsxy.communityservice.core.model.common;

import lombok.Getter;

@Getter
public enum ResultCodeEnum {
    SUCCESS(200, "成功"),
    //通用错误（1xx-5xx遵循HTTP状态码语义）
    SYSTEM_ERROR(500, "服务器内部错误"),
    PARAM_ERROR(400, "参数校验失败"),
    UNAUTHORIZED(401, "未授权访问"),
    FORBIDDEN(403, "权限不足或禁止访问"),
    NOT_FOUND(404, "资源不存在"),

    // 业务错误（自定义错误码，建议从1000开始）
    USER_NOT_FOUND(1001, "用户不存在"),
    USER_NAME_DUPLICATE(1002, "用户名已存在"),
    ORDER_STATUS_ERROR(2001, "订单状态错误");
    // 错误码
    private final int code;
    // 错误描述
    private final String message;
    ResultCodeEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

}
